# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper

def tag_cloud(tags, classes)
  max, min = 0, 0
  tags.each { |t|
    count = t.taggings.count
    max = count if count > max
    min = count if count < min
  }

  divisor = ((max - min) / classes.size) + 1

  tags.reverse.each { |t|
    yield t.name, classes[(t.taggings.count - min) / divisor]
  }
end

end
